/*	
 *				
 *					ISNW ---- It is a war.It is not warcraft!
 *
 *
 *					Author:					zhoukeli(haxixi_keli)
 *					Filename:				D3DDriver.h
 *					CreateTime:				2008/12/21
 *					ModifyTime:				2008/12/21
 *
 */

#ifndef __ISNW_D3D_DRIVER_H__
#define __ISNW_D3D_DRIVER_H__

#include "../ISNW_Gui/ISNW_d3d/ISNW_d3d.h"
#include "include/IDriver.h"
#include "include/isnwVertex.h"
#include "include/isnwArray.h"
#include "include/isnwColor.h"
#include "include/IImage.h"
#include "include/IFileSystem.h"
#include "include/IImageLoader.h"
#include "include/isnwList.h"

namespace ISNW
{
namespace video
{
	class D3DDriver : public IDriver
	{
	public:
		//! constructor
		D3DDriver(io::IFileSystem* fs);

		//! destructor
		~D3DDriver();

	public:
		//! functions
		bool drawtriangles(void* v_buffer,E_VERTEX_TYPE v_type,u32 vertex_num,void* i_buffer,u32 primitive_num);

		LPDIRECT3DDEVICE9 getdevice();

		bool setmaterial(video::material m);

		void setTransform(TRANSFORM_TYPE,core::matrix4f);

		IImage* getImage(const c8*) const;

	protected:
		//! internal functions
		u32 getstride(E_VERTEX_TYPE v_type);

		void initd3dcolorvalue(D3DCOLORVALUE& cv,f32 red,f32 green,f32 blue,f32 alpha);

		void initd3dcolorvalue(D3DCOLORVALUE& cv,video::color32 c);

	protected:
		LPDIRECT3DDEVICE9	device9;

		io::IFileSystem*	FS;

		core::list<IImageLoader*> ImageLoaders;
	};
}
}

#endif